|
|
|
|
|
|
|
Figure 18.4.
Sequence of events for typical error handling involving a foreign object
used by a local component. User notification is indicated. |
|
|
|
|
|
|
|
|
Describing the Classes in the Subsystem |
|
|
|
|
|
|
|
|
The ErrorHandler class is the only one in this subsystem. In a distributed or Web-based system, similar objects will typically implement the interface of ErrorHandler, and in many cases, delegate some policy enforcement responsibility to ErrorHandler. |
|
|
|
|
|
|
|
|
The handleErrors method is the only public interface method exposed. This is due to the relatively straightforward nature of error handling. Within it are calls to specialized private methods that handle various kinds of errors you deem important. For instance, handleMathErrors handles all errors related to math errors, handleDBErrors handles errors related to the database, while handleNetworkErrors handles network-related errors. |
|
|
|
|
|
|
|
|
The handleErrors method would look something like this: |
|
|
|
|
|
|
|
|
Public Sub handleErrors(argErrorObject As ErrObject)
Set LocalErrObject = argErrorObject
handleMathErrors
handleDBErrors
handleNetworkErrors
handleUnknownErrors
End Sub |
|
|
|
|
|
|
|
|
The argument, argErrorObject, contains a reference to an incoming Err object from a client object. The LocalErrObject is a module-level variable to temporarily hold a reference to the argument. Each of the private methods are invoked, but only the method to |
|
|
|
|
|